package com.qf.job;

import org.apache.shardingsphere.elasticjob.api.ShardingContext;
import org.apache.shardingsphere.elasticjob.simple.job.SimpleJob;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @author 千峰教育
 * @Company http://www.mobiletrain.org/
 * @Version 1.0
 */
@Component
public class MyJob implements SimpleJob {
    @Override
    public void execute(ShardingContext shardingContext) {
        int shardingItem = shardingContext.getShardingItem();

        switch (shardingItem){
            case 0:
                System.out.println(new Date() + "执行了0"); break;
            case 1:
                System.out.println(new Date() + "执行了1"); break;
            case 2:
                System.out.println(new Date() + "执行了2"); break;
            case 3:
                System.out.println(new Date() + "执行了3"); break;
            default:
                System.out.println(new Date() + "执行了default"); break;
        }

    }
}
